/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2020-07-19
 * Time: 21:03
 */
#include "Cast.h"

void Cast::static_cast_test() {

}

void Cast::dynamic_cast_test() {

}

/**
 * @brief 对指针、引用、对象指针进行加减 const
 */
void Cast::const_cast_test() {
    int ss = 10;
    const int * a = &ss;
    int * b = const_cast<int*>(a);

}

/**
 * @brief 无关类型进行转换，但需注意空间占用大小问题。类似于 C中的括号进行强转。
 */
void Cast::reinterpret_cast_test() {
    //1. 无关指针类型进行转换
    Building *building = nullptr;
    Animal *animal = reinterpret_cast<Animal *>(building);

    //2. 函数指针转换
    FUNC * func1;
    FUNC2 * func2 = reinterpret_cast<FUNC2 *>(func1);
}
